<!DOCTYPE HTML>
<html>
<head>
    <meta charset=utf-8>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1"/>
    <link href="css/style.css" rel="stylesheet"/>
    <title>注册</title>
</head>
<body>
<div id="head">
    <div class="memu">
        <div class="logo"><img src="images/logo.ico"></div>
        <div class="nav">
            <ul class="nav_firstul">
                <li><a href="/pages/webviews/home.html">首页</a></li>
                <li><a href="xtgg.html">系统公告</a></li>
                <!-- <li><a href="">论坛与帮助</a></li>  -->
            </ul>
        </div>
        <div class="loginse">
            <a href="login.html">登录</a> &nbsp;&nbsp;|&nbsp;&nbsp;
            <a href="register.html">注册</a>
        </div>
    </div>
</div>

<div id="con">
    <form  class="form-horizontal" type="post" method="post" action="/WebResgistServlet">
        <div class="basicinformation">
            <div class="i_title"><span class="truename">基本信息</span></div>
            <div class="name">
                <div class="n_right">
                    <input type="text" class="n_input" id="userName" name="username" placeholder="请输入您的真实姓名">
                    <div class="n_tips"></div>
                </div>
                <div class="n_title">真实姓名</div>
            </div>

            <div class="name">
                <div class="n_right">
                    <input type="text" class="n_input" id="email" name="regemail" placeholder="作为登录帐号，输入您的或公司的邮箱">
                    <div class="n_tips"></div>
                </div>
                <div class="n_title">登录邮箱</div>
            </div>

            <div class="name">
                <div class="n_right">
                    <input type="password" class="n_input" id="password" name="regpassword" placeholder="请输入您的密码">
                    <div class="n_tips"></div>
                </div>
                <div class="n_title">密码</div>
            </div>

            <div class="name">
                <div class="n_right">
                    <input type="password" class="n_input" id="confirmpassword" name="confirmpassword"
                           placeholder="请再次输入您的密码">
                    <div class="n_tips"></div>
                </div>
                <div class="n_title">确认密码</div>
            </div>
        </div>

        <div class="two_button">
            <input type="submit" class="button1" style="border:0px;cursor:pointer;" value="确 认"/>
            <input id="bth_cancle" type="button" class="button2" style="border:0px;cursor:pointer;" value="取 消"/>
        </div>
    </form>
</div>

<div id="footer">
    <div class="foot">
        <p class="copyright">© 2019 Web Book Store Management platform.</p>
        <p class="footlike"><a href="user_xy.html">用户协议</a> &nbsp; | &nbsp; <a href="contact_us.html">联系我们</a></p>
    </div>
</div>
</body>
<script type="text/javascript" src="/static/assets/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/assets/js/template.js"></script>
<script type="text/javascript" src="/static/assets/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/additional-methods.js"></script>
<script type="text/javascript" src="/static/assets/js/jquery.form.js"></script>
<script type="text/javascript" src="/static/plugins/layer/layer.js"></script>
<script type="text/javascript">
    $("#bth_cancle").click(function () {
        window.location.href = "/index.html";
        return false;
    });

    //初始化上传
    upload.init($("input[name='category']").val(), 10485760, function (response) {
        if (response.result) {
            $("input[name='businessLicense']").val(response.filename);
        }
    });

    $("#subform").validate({
        //errorClass: "label.error", //默认为错误的样式类为：error
        focusInvalid: false, //当为false时，验证无效时，没有焦点响应
        //onkeyup: false,
        submitHandler: function (form) {   //表单提交句柄,为一回调函数，带一个参数：form

            jQuery(form).ajaxSubmit({
                dataType: "json",
                type: "post",
                success: function (data) {
                    if (data.result) {
                        window.location.href = "login.html";
                    } else {
                        //$("#error-message").css({"display": "block"}).find("span").text(data.message);
                        layer.alert(data.message, {icon: 2, title: "错误信息"});
                        return false;
                    }
                },
                error: function () {
                    layer.alert("网络异常,请稍候再试", {icon: 2, title: "错误信息"});
                }
            });
        },
        errorPlacement: function (error, element) {
            error.appendTo(element.next("div"));
        },
        rules: {
            username: {
                required: true,
                rangelength: [2, 10]
            },
            regemail: {
                required: true,
                email: true
            },
            regpassword: {
                required: true,
                rangelength: [6, 15]
            },
            confirmpassword: {
                required: true,
                rangelength: [6, 15],
                equalTo: "#password"
            },
            company: {
                required: true
            },
            mobile: {
                required: true,
                phone: true
            },
            address: {
                required: true
            }
        },
        messages: {
            username: {
                required: "请输入您的姓名!",
                rangelength: "姓名输入有误!"
            },
            regemail: {
                required: "请输入您的邮箱",
                email: "您输入的邮箱格式有误!"
            },
            regpassword: {
                required: "请输入密码!",
                rangelength: $.validator.format("密码最小长度:{0}, 最大长度:{1}。")
            },
            confirmpassword: {
                required: "请输入确认密码!",
                rangelength: $.validator.format("密码最小长度:{0}, 最大长度:{1}。"),
                equalTo: "两次密码输入不一致!"
            },
            company: {
                required: "请输入您的公司名称!"
            },
            mobile: {
                required: "请输入您的联系电话!",
                phone: "您输入的联系电话格式不正确!"
            },
            address: {
                required: "请输入您的联系地址"
            }
        }
    });


</script>

</html>
